package code06_数组;
import java.util.Arrays;
import java.util.Scanner;
/**
 * @author 黄衡熙
 * @version 1.0
 * @date 2025年07月17日10:12
 */
public class Test06_练习 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入学生数量:");
        int num = sc.nextInt();
        double[] scores = new double[num];
        // 定义一个变量,用于接收总成绩
        double sum = 0.0;
        for (int i = 0; i < scores.length; i++) {
            System.out.print("请输入第" + (i + 1) + "名学生成绩:");
            scores[i] = sc.nextDouble();
            sum += scores[i];
        }
        // 排序
        Arrays.sort(scores);
        System.out.println("最大值:" + scores[num - 1]);
        System.out.println("最小值:" + scores[0]);
        System.out.println("平均值:" + sum / num);
    }

}
